<!-- 开发票功能组件 -->
<template>
  <el-dialog
    :title="dialogTitle"
    :visible.sync="visible"
    width="500px"
    append-to-body
    :close-on-click-modal="false"
  >
    <div class="dialog-content">
      <p>{{ message }}</p>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleCancel">取 消</el-button>
      <el-button type="primary" @click="handleSubmit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "IssueInvoiceDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    count: {
      type: Number,
      default: 0
    }
  },
  computed: {
    dialogTitle() {
      return '系统提示';
    },
    message() {
      return `是否对此${this.count}条信息开发票？`;
    }
  },
  methods: {
    handleCancel() {
      this.$emit('close');
    },
    handleSubmit() {
      this.$emit('confirm', this.count);
    }
  }
};
</script>

<style scoped>
.dialog-content {
  padding: 20px;
  text-align: center;
}

.dialog-footer {
  text-align: right;
}
</style>